<html>
 <head>
    <title>[var.TITLE]</title>
    <link href="[var.ROOT_CSS_DIR]/main.css" rel="STYLESHEET" type="text/css" charset="iso-8859-1" hreflang="en-us">
    <link href="[var.ROOT_CSS_DIR]/facet/style.css" rel="STYLESHEET" type="text/css" charset="iso-8859-1" hreflang="en-us">
    <script type="text/javascript" src="[var.ROOT_DIR]js/common.js"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/doiMenuDOM.js"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/functions.js"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsmenu.php"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsmenu.cfg"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsformgrid.php?session=[var.SessionVar]"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsmasks.js"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsverify.php?session=[var.SessionVar]"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsinit.php?session=[var.SessionVar]"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jquery.min.js"></script>
 </head>
 <body bgcolor="FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
    <table border="0" cellspacing="0" cellpadding="0" width="100%" align="[var.POSITION]">
        <tr>
            <td>[tbs_include.onshow;file=[var.HTMLHeader];getob;]</td>
        </tr>
        <tr>
            <td>
            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                <tr>
                    <td class="mainmenu2"><img src="images/spacer.gif" height="1" width="1"></td>
                </tr>
                <tr>
                    <td background="[var.ROOT_IMG_DIR]/back-menu.gif">
                    <table border="0" cellspacing="0" cellpadding="0" width="100%">
                        <tr>
                            <td>
                            <script language="JavaScript" type="text/JavaScript">menu.Build();</script>
                          </td>
                          <td class="head-login">Login as [var.USERPROFILE_NAME]</td>
                        </tr>
                      </table>
                    </td>
                </tr>
                <tr>
                    <td class="mainmenu2"><img src="images/spacer.gif" height="1" width="1"></td>
                </tr>
            </table>
            </td>
        </tr>
        <tr height="100%">
            <td>
            <table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
                <tr valign="top">
                    <td width="100%">
                        <table border="0" cellspacing="0" cellpadding="0" width="100%">
                            <tr>
                                <td class="head-path"></td>
                                <td class="corner-date">[var.CORNER_DATE]</td>
                            </tr>
                        </table>
                        <table border="0" cellspacing="0" cellpadding="5" width="100%">
                            <tr>
                                <td class="FacetHeaderContent" >.:[var.SubHeaderTitle]:.</td>
                            </tr>
                        </table>

                        <table border="0" cellspacing="0" cellpadding="5" width="100%">
                            <tr>
                                <td class="contentTitle">
                                Menu
                                </td>
                            </tr>
                            <tr>
                                <td class="content2">
                                <table cellspacing="2" cellpadding="0">
                                 <tr>
                                   <td>
                                    <input type="button" name="Action" value="<<Back" class="button" onClick="self.location.replace('[var.GOTO]')">
                                   </td>
                                   <td>[tbs_check;block=td;if [var.USER_CANAPPROVAL1]=1]
                                   <input type="button" name="Action" value="Approval1" class="button" onClick="if (confirm('Are you sure want to approve this transaction ?')) {[var.HTMLFormName].action='[var.FormAction;htmlconv=no]&FormAction=Approval&Type=Approval1';[var.HTMLFormName].submit();}">
                                   </td>
                                   <td>[tbs_check;block=td;if [var.USER_CANAPPROVAL2]=1]
                                   <input type="button" name="Action" value="Approval2" class="button" onClick="if (confirm('Are you sure want to approve this transaction ?')) {[var.HTMLFormName].action='[var.FormAction;htmlconv=no]&FormAction=Approval&Type=Approval2';[var.HTMLFormName].submit();}">
                                   </td>
                                   <td>[tbs_check;block=td;if [var.USER_CANAPPROVAL3]=1]
                                   <input type="button" name="Action" value="Approval3" class="button" onClick="if (confirm('Are you sure want to approve this transaction ?')) {[var.HTMLFormName].action='[var.FormAction;htmlconv=no]&FormAction=Approval&Type=Approval3';[var.HTMLFormName].submit();}">
                                   </td>
                                 </tr>
                                </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="content2">
                        <!-- FORM SECTION -->
                        <table border="0" cellspacing="0" cellpadding="0" width="100%">
                        <form method="post" action="[var.FormAction;htmlconv=no]" name="[var.HTMLFormName]" ONSUBMIT="if (this.submitted) return true; else return false;">
                                                <input name="Trans" type="hidden" value="[var.Trans]">
                              <tr>
                                <td class="fieldCaption" align="right">Transaction Type</td>
                                <td class="fieldCaption" width="2">:</td>
                                <td class="fieldCaption">
                                <select name="type" class="input" onchange="SwitchBankCash (this.value)" [tbs_check;if [var.FormMode]=Edit;then 'disabled']>
                                  <option value="Bank">Bank</option>
                                  <option value="Cash">Cash</option>
                                  <option>[var.ttype;selected;noerr]</option>
                                </select>
                                </td>

                                <td class="fieldCaption" align="right">Source</td>
                                <td class="fieldCaption" width="2">:</td>
                                <td class="fieldCaption">
                                <select name="[headbln.source]" class="input">
                                  <option value="">-</option>
                                  <option value="DN">Debit Note</option>
                                  <option value="Other">Other</option>
                                  <option>[headblv.source;selected;noerr]</option>
                                 </select>
                                </td>
                              </tr>

                              <tr>
                                <td class="fieldCaption" align="right">ID No.</td>
                                <td class="fieldCaption" width="2">:</td>
                                <td class="fieldCaption">
                                <input type="text" name="[headbln.nobkt]" value="[tbs_check;if [var.FormMode]=Edit;then [headblv.nobkt] ;else 'AUTO NUMBERED BY SYSTEM']" maxlength="255" size="25" class="input" onkeyup="this.value=this.value.toUpperCase()" class="input" readonly>
                                <input type="hidden" name="aslref" value="[var.PRIMARY_VALUE]" maxlength="255" size="25" class="input" >
                                <input type="hidden" name="Trans" value="[var.Trans]" maxlength="255" size="25" class="input" >
                                </td>

                                <td class="fieldCaption" align="right">Transaction Date</td>
                                <td class="fieldCaption" width="2">:</td>
                                <td class="fieldCaption">
                                <input type="text" name="[headbln.tglbkt]" value="[tbs_check;if [var.FormMode]=Edit;then [headblv.tglbkt;frm='dd/mm/yyyy']; else [sys.now;frm='dd/mm/yyyy']]" maxlength="255" size="10" class="input" >
                                <a href="javascript:void(0)" onclick="gfPop.fPopCalendar([var.HTMLFormName].[headbln.tglbkt]);return false;" hidefocus>
                                    <img name="popcal" align="absMiddle" src="[var.ROOT_DIR]js/Calendar/pop/calbtn.gif" width="34" height="22" border="0" alt=""></a>
                                </td>
                              </tr>
                              <tr id="bankfield">
                                <td class="fieldCaption" align="right">Bank</td>
                                <td class="fieldCaption" width="2">:</td>
                                <td class="fieldCaption">
                                <select name="[headbln.kdbank]" class="input" onchange="GetSkada999()">
                                  <option value="">-</option>
                                                                                  <option value="[bankblk.kdbank]">[bankblk.kdbank]-[bankblk.banknam;block=option] &nbsp;&nbsp;([bankblk.balance;frm='0,000.00'])</option>
                                                                                  <option>[headblv.kdbank;selected;noerr]</option>
                                                                            </select>
                                </td>
                                <td class="fieldCaption" align="right"></td>
                                <td class="fieldCaption" width="2"></td>
                                <td class="fieldCaption"></td>
                              </tr>
                              <tr id="cashfield">
                                <td class="fieldCaption" align="right">Cash</td>
                                <td class="fieldCaption" width="2">:</td>
                                <td class="fieldCaption">
                                <select name="[headbln.kdcash]" class="input" onchange="GetSkada999()">
                                  <option value="">-</option>
                                  <option value="[cashblk.kdcash]">[cashblk.kdcash]-[cashblk.cashnam;block=option] &nbsp;&nbsp;([cashblk.balance;frm='0,000.00'])</option>
                                  <option>[headblv.kdcash;selected;noerr]</option>
                                </select>
                                </td>
                                <td class="fieldCaption" align="right"></td>
                                <td class="fieldCaption" width="2"></td>
                                <td class="fieldCaption"></td>
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Currency</td>
                                <td class="fieldCaption" width="2">:</td>
                                <td class="fieldCaption"><input type="text" name="[headbln.curr]" id="[headbln.curr]" value="[headblv.curr;noerr]" size="4" class="input" readonly /></td>
                                <td class="fieldCaption" align="right">Currency Rate</td>
                                <td class="fieldCaption" width="2">:</td>
                                <td class="fieldCaption">
                                <input type="text" name="[headbln.rate]" value="[headblv.rate;frm='0,000.00']" maxlength="255" size="10" class="inputNumber" readonly>
                                </td>
                              </tr>
                              <tr>
                               <td class="fieldCaption" align="right">Debtur</td>
                               <td class="fieldCaption" width="2">:</td>
                               <td class="fieldCaption">
                                <select name="debturList" class="input" onchange="GetReceived(this.value);">
                                    <option value="" selected>Select Value</option>
                                    <option value="1">Debtur</option>
                                    <option value="2">Staff</option>
                                    <option value="4">Other</option>
                                </select>
                                <input type="text" name="[headbln.debnam]" value="[headblv.debnam]" maxlength="255" size="15" class="input">
                                <input type="hidden" name="[headbln.debtur]" value="[headblv.debtur]">
                               </td>
                                <td class="fieldCaption" align="right">Order No</td>
                                <td class="fieldCaption" width="2">:</td>
                                <td class="fieldCaption">
                                <input type="text" name="[headbln.noorder]" value="[headblv.noorder]" maxlength="255" size="10" class="input">
                                </td>
                              </tr>
                              <tr id="paymentfield">
                                <td class="fieldCaption" align="right">Payment By</td>
                                <td class="fieldCaption" width="2">:</td>
                                <td class="fieldCaption">
                                <select name="[headbln.payby]" class="input" onchange="SwitchGiroCash(this.value)">
                                      <option value="">-</option>
                                      <option value="Transfer">Transfer</option>
                                      <option value="Cek / BG">Cek / BG</option>
                                      <option>[headblv.payby;selected;noerr]</option>
                                </select>
                                </td>

                                <td class="fieldCaption" align="right"></td>
                                <td class="fieldCaption"></td>
                                <td class="fieldCaption">
                                </td>

                              </tr>

                              <tr id="girofields">
                                <td class="fieldCaption" align="right">No Cek</td>
                                <td class="fieldCaption" width="2">:</td>
                                <td class="fieldCaption">
                                                            <input type="text" name="[headbln.nocek]" value="[headblv.nocek]" maxlength="255" size="25" class="input" onkeyup="this.value=this.value.toUpperCase()">
                                </td>

                                <td class="fieldCaption" align="right">Due Date</td>
                                <td class="fieldCaption" width="2">:</td>
                                <td class="fieldCaption">
                  <input type="text" name="[headbln.duedate]" value="[headblv.duedate;frm='dd/mm/yyyy']" maxlength="255" size="10" class="input">
                                <a href="javascript:void(0)" onclick="gfPop.fPopCalendar([var.HTMLFormName].[headbln.duedate]);return false;" hidefocus>
                                    <img name="popcal" align="absMiddle" src="[var.ROOT_DIR]js/Calendar/pop/calbtn.gif" width="34" height="22" border="0" alt=""></a>

                                </td>
                              </tr>
                         </table>
                         <!-- FORM SECTION -->
                                </td>
                            </tr>
                        </table>
                        <hr size="1" color="DFDFDF">
                        <div id="spanHeader" style="height: 25px; vertical-align: top; overflow-y: noscroll;">
                        <table border="0" width="100%" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="left">
                        <input type=hidden name="NewData" value="[var.NewDataStart]">
                            <tr>
                                <td nowrap class="FacetColumnTD" align="center" width="50">No.</td>
                                <td nowrap class="FacetColumnTD" align="center" width="350">Description.</td>
                                <td nowrap class="FacetColumnTD" align="center" width="200">Amount</td>
                                <td nowrap class="FacetColumnTD" align="center" width="150">COA</td>
                                <td nowrap class="FacetColumnTD" align="center" width="150">UU</td>
                                <td nowrap class="FacetColumnTD" align="center">Ref</td>
                            </tr>
                        </table>
                        </div>

                        <div id="spanDetail" style="height: 200px; vertical-align: top; overflow: auto;">
                        <table border="0" width="100%" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="left">
                        
                            <input type=hidden name="NewData" value="[var.NewDataStart]">
                            <tr id="[blg.#]" style="display:[blg._display;noerr]">
                            
                                <td nowrap class="FacetDataTD" width="50" align="center">
									[blg.#;block=tr].
									<input type="hidden" name="urut[blg.#]" value="[blg.#]" >
									<input type="hidden" name="norefnd[blg.#]" value="[blg.norefnd]">
                                </td>
                                <td nowrap class="FacetDataTD"  width="350" align="center">
                                    <input type="text" name="uraian[blg.#]" value="[blg.uraian]" maxlength="255" size="35" class="input" onchange="this.value=this.value.toUpperCase()">
                                </td>
                                <td nowrap class="FacetDataTD" width="200" align="center">
                                <input type="text" name="jumlah[blg.#]" value="[blg.jumlah;frm='0,000.00']" maxlength="255" size="10" class="inputnumber" onkeyup="GetTotal()">
                                </td>
                                <td class="FacetDataTD" width="150" align="center">
                                <input type="text" name="skada[blg.#]" value="[blg.skada]" maxlength="255" size="10" class="input" onclick="openSkada([blg.#])" onkeyup="openSkada([blg.#])" readonly >
                                </td>
                                <input type=hidden name="dk[blg.#]" value="K">
                              <td class="FacetDataTD" width="150" align="center">
                              <select name="kdact[blg.#]" class="input">
                                  <option value="">-</option>
                          <option value="[actblk.kdact]">[actblk.kdact;block=option]</option>
                                  <option>[blg.kdact;selected;noerr]</option>
                                </select>
                                </td>
                                <td class="FacetDataTD" align="center">
                                <input type="text" name="noref[blg.#]" value="[blg.noref]" maxlength="255" size="15" class="input" onchange="this.value=this.value.toUpperCase()">
                                <input type="hidden" name="nobkta[blg.#]" value="[blg.noref]" maxlength="255" size="6" class="input">
                                </td>
                                
                            </tr>
                            
                        </table>
                        </div>

                        <div id="spanDetail999" style="height: 25px; vertical-align: top; overflow: noscroll">
                        <table border="0" width="100%" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="left">
                            <tr id="999" style="display:[blg._display;noerr]">
                                <td nowrap class="FacetDataTD" width="50" align="center">
                                999.
                                </td>
                                <td nowrap class="FacetDataTD"  width="350" align="center">
                                <input type="text" name="uraian999" value="[blg9.uraian]" maxlength="255" size="35" class="input" onchange="this.value=this.value.toUpperCase()">
                                </td>
                                <td nowrap class="FacetDataTD" width="200" align="center">
                                <input type="text" name="total_trans" value="[blg9.jumlah]" maxlength="255" size="15" class="inputNumber">
                                </td>
                                <td class="FacetDataTD" width="150" align="center">
                                <input type="text" name="skada999" value="[blg9.skada]" maxlength="255" size="10" class="input" >
                                </td>
                                <input type=hidden name="dk999" value="D">
                                <td class="FacetDataTD" width="150" align="center">
                              <select name="kdact999" class="input">
                                  <option value="">-</option>
                          <option value="[actblk999.kdact]">[actblk999.kdact;block=option]</option>
                                  <option>[blg9.kdact;selected;noerr]</option>
                                </select>

                                </td>
                                <td class="FacetDataTD" align="center">
                                <input type="text" name="noref999" value="[blg9.noref]" maxlength="255" size="15" class="input" onchange="this.value=this.value.toUpperCase()">
                                </td>
                            </tr>
                        </table>
                        </div>

                        <div id="spanButton" style="height: 35px; vertical-align: top; overflow-y: noscroll;">
                        <table border="0" width="100%" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="left">
                            <tr>
                                <td align="right" class="FacetColumnTD">
                                <table border="0" cellspacing="2" cellpadding="0">[tbs_check;block=table;if [var.PERIOD_OPENED]=1]
                                    <tr>
                                        <td>[tbs_check;block=td;if [var.USER_CANINSERT]=1]
                                        <input name="buttonForm" type="submit" value="Next Line" class="button" onclick="if(CheckPeriod ()){return AddFormGrid(this,'document.[var.HTMLFormName].uraian')}">
                                        </td>
                                        <td>[tbs_check;block=td;if [var.USER_CANINSERT]=1][tbs_check;block=td;if [var.USER_CANUPDATE]=1]
                                        <input name="buttonForm" type="submit" value="Save" class="button" ONCLICK="CheckBankCash ();if (CheckPeriod () && VerifyForm(this.form)  && CheckAllGrid('[var.HTMLFormName].uraian')) {this.form.action='[var.FormAction;htmlconv=no]&FormAction=Save';this.form.submitted = true; return true;}">
                                        </td>
                                        <td>[tbs_check;block=td;if [var.USER_CANDELETE]=1]
                                        <input type="button" name="Action" value="Delete" class="button" onClick="if (confirm('Are you sure want to delete ?')) {[var.HTMLFormName].action='[sys.script_name]?FormAction=Delete&[var.PRIMARY_KEY]=[var.PRIMARY_VALUE]&PageMode=Form&form=[var.HTMLFormName]';[var.HTMLFormName].submit();}">
                                        </td>
                                        <td>
                                        <input name="buttonForm" type="reset" value="Cancel" class="button" onClick="self.location.replace('[sys.script_name]')">
                                        </td>
                                    </tr>
                                </table>
                                </td>
                                </td>
                            </tr>
                            </form>
                        </table>
                        </div>
                    </td>
                </tr>
            </table>
            </td>
        </tr>
        <tr>
            <td>
            <br>
            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                <tr>
                    <td class="footer1"><img src="images/spacer.gif" height="1" width="1"></td>
                </tr>
                <!--tr>
                    <td class="footer2">Prototype Test - Web Application</td>
                </tr-->
            </table>
            </td>
        </tr>
    </table>
<iframe width="174" height="189" name="gToday:normal:agenda.js" id="gToday:normal:agenda.js" src="[var.ROOT_DIR]js/Calendar/pop/ipopeng.htm" scrolling="no" frameborder="0" style="LEFT: -500px; POSITION: absolute; TOP: 0px; VISIBILITY: visible; Z-INDEX: 999"></iframe>
 </body>
 <script>
 [var.InitFunction]
 document.[var.HTMLFormName].dk1.value='K';
 SwitchGiroCash (document.[var.HTMLFormName].payby.value);
 var DataGrid = Array();
 var IdxCounter = 0;

 GetTotal ();
 SwitchBankCash (document.[var.HTMLFormName].type.value);

  function SwitchGiroCash (val) {
     if (val=="Cek / BG") {
        document.getElementById("girofields").style.display = "";
        document.[var.HTMLFormName].nocek.disabled = false;
        document.[var.HTMLFormName].duedate.disabled = false;
     } else {
         document.getElementById("girofields").style.display = "none";
         document.[var.HTMLFormName].nocek.disabled = true;
         document.[var.HTMLFormName].duedate.disabled = true;
     }
  }

  function CheckBankCash () {
    if (document.[var.HTMLFormName].type.value=="Bank") {
        if (document.[var.HTMLFormName].kdbank.value=="") {
            errmessage += "Value in Bank is required!\n";
            return false;
        } else return true;
    }
    else if (document.[var.HTMLFormName].type.value=="Cash") {
        if (document.[var.HTMLFormName].kdcash.value=="") {
            errmessage += "Value in Cash is required!\n";
            return false;
        } else return true;
    }
 }

 function SaveAndExit (debtur,debnam,curr,rate) {
    document.[var.HTMLFormName].debtur.value = debtur;
    document.[var.HTMLFormName].debnam.value = debnam;
    for (x=0;x<DataGrid.length;x++) {
        n=x+1;
        var RowTable = document.getElementById(n);
        RowTable.style.display = "block";
        eval("document.[var.HTMLFormName].uraian"+n+".value=DataGrid["+x+"].uraian");
        eval("document.[var.HTMLFormName].jumlah"+n+".value=DataGrid["+x+"].amount");
        eval("document.[var.HTMLFormName].skada"+n+".value=DataGrid["+x+"].skada");
        eval("document.[var.HTMLFormName].dk"+n+".value=DataGrid["+x+"].dk");
        eval("document.[var.HTMLFormName].kdact"+n+".value=DataGrid["+x+"].kdact");
        eval("document.[var.HTMLFormName].noref"+n+".value=DataGrid["+x+"].nobkt");
    }
    document.[var.HTMLFormName].total_trans.value = SumTotal("jumlah");

 }

 function SwitchBankCash (val) {
     if (val=="Bank") {
         document.getElementById("cashfield").style.display = "none";
         document.getElementById("bankfield").style.display = "";
         document.[var.HTMLFormName].[headbln.kdbank].disabled=false;
         document.[var.HTMLFormName].[headbln.kdcash].disabled=true;
         document.getElementById("paymentfield").style.display = "";
         document.[var.HTMLFormName].[headbln.nocek].disabled=false;
         document.[var.HTMLFormName].[headbln.duedate].disabled=false;
         document.[var.HTMLFormName].[headbln.payby].disabled=false;

     } else {
         document.getElementById("bankfield").style.display = "none";
         document.getElementById("cashfield").style.display = "";
         document.[var.HTMLFormName].[headbln.kdbank].disabled=true;
         document.[var.HTMLFormName].[headbln.kdcash].disabled=false;
         document.getElementById("paymentfield").style.display = "none";
         document.[var.HTMLFormName].[headbln.nocek].disabled=true;
         document.[var.HTMLFormName].[headbln.duedate].disabled=true;
         document.[var.HTMLFormName].[headbln.payby].disabled=true;
     }
 }

 function SwitchSource(form,val) {
    if (val.length>0) {
      togglefield(form, false);
    } else {
      togglefield(form, true);
    }
      form.[headbln.source].disabled = false;
 }

 function togglefield(theform, enabled) {
    for (var i = 0; i < theform.elements.length; i++) {
              theform.elements[i].disabled = enabled;
    }
 }

 function GetTotal () {
    document.[var.HTMLFormName].total_trans.value = SumTotal("jumlah");
 }

 function GetReceived(val) {
     switch (val){
        case "1":
            if (document.[var.HTMLFormName].[headbln.source].value=="DN")
            newwin = window.open("../transaction/ais_transaction_custlist.php?FormName=[var.HTMLFormName]&transDate="+document.[var.HTMLFormName].tglbkt.value,"toolcalc","height=400,width=640,noscroll,resizable");
            else
            newwin = window.open("../transaction/ais_transaction_custlist.php?FormName=[var.HTMLFormName]&SendToBack=1","toolcalc","height=400,width=640,noscroll,resizable");
            break;
        case "2":
            newwin = window.open("../transaction/ais_transaction_stafflist.php?FormName=[var.HTMLFormName]&SendToBack=1","toolcalc","height=400,width=640,noscroll,resizable");
            break;
        case "3":
            newwin = window.open("../transaction/ais_transaction_vendorlist.php?FormName=[var.HTMLFormName]&transDate="+document.[var.HTMLFormName].tglbkt.value,"toolcalc","height=400,width=640,noscroll,resizable");
            break;
        case "4":
            newwin = window.open("../transaction/ais_transaction_otherlist.php?FormName=[var.HTMLFormName]&SendToBack=1","toolcalc","height=400,width=640,noscroll,resizable");
            break;

     }
 }

function OpenCalc(formname, desc, total, act, qty, tarif) {
    newwin = window.open("../transaction/ais_transaction_calc.php?PageMode=Form&desc="+desc+"&total="+total+"&act="+act+"&qty="+qty+"&tarif="+tarif+"&formname="+formname,"toolcalc","height=10,width=450,noscroll,resizable")
}


 function GetSkada999() {
   if (document.[var.HTMLFormName].type.value=="Bank") {
     tgl_curr = document.[var.HTMLFormName].[headbln.kdbank].value;
     LoadRPC ("iLoader", "[var.FileName]", "bank="+document.[var.HTMLFormName].[headbln.kdbank].value);
   } else {
        tgl_curr = document.[var.HTMLFormName].[headbln.kdcash].value;
        LoadRPC ("iLoader", "[var.FileName]", "cash="+document.[var.HTMLFormName].[headbln.kdcash].value);
   }
 }

 function GetRate(curr) {
     tgl_curr = document.[var.HTMLFormName].tglbkt.value;
     if (tgl_curr.length) LoadRPC ("iLoader", "[var.FileName]", "curr="+curr+"&tglbkt="+tgl_curr);
 }

 //dyah.24 juli 2009, modified 27 july 2009
 function CheckPeriod () {
     //if (ledger.length) LoadRPC ("iLoader", "[var.FileName]", "ledger="+ledger+"&trsto=tglbkt");
     var ledger = document.[var.HTMLFormName].tglbkt.value;
     var value = "open";

     var param = 'ledger='+ledger;
     $.ajax({ type: "post", url: "../transaction/ais_transaction_check_period.php", data: param, dataType: "xml",
         success: function(xml){
            $('status', xml).each(function(i){
               value = $('periodstatus', this).text();
            });
        },
        async:   false,
     });

     if(value == "open"){
        return true;
     }else{
        alert('Invalid Date, Period Already Closed Or Not Yet Opened!');
        return false;
     }

 }

 function GetSkada() {
     skada1 = document.[var.HTMLFormName].thbl.value;
     if (skada1.length) LoadRPC ("iLoader", "[var.FileName]", "thbl="+document.[var.HTMLFormName].thbl.value);
 }

 function SumTotal (component) {
     //oMask = new Mask('#,###.#0', 'number');
     var comp_str = "document.[var.HTMLFormName]."+component;

     var TotalComponent = [var.MaxGrid] + [var.NewDataStart] - 1;
     var sum_all = 0;
     var subtotal = 0;
     var js_str = "";

     for (x=1;x<=TotalComponent;x++) {
       js_str = "subtotal = "+comp_str+x+".value;\n";
       js_dk  = "dk_val = "+"document.[var.HTMLFormName]."+"dk"+x+".value;\n";
       eval (js_str+js_dk);

       if (subtotal.length) subtotal = StrToNumber(subtotal);
       else subtotal = 0;
       if (dk_val=="D") sum_all = sum_all + parseFloat(subtotal);
       else if (dk_val=="K") sum_all = sum_all - parseFloat(subtotal);
     }
     if (sum_all<0) {
        sum_all  = sum_all * -1;
        document.[var.HTMLFormName].dk999.value="D";
     } else document.[var.HTMLFormName].dk999.value="K";
     //return oMask.format(sum_all);
     return cistFormatMoney(sum_all);
 }

 function openSkada(idx) {
       if (document.[var.HTMLFormName].type.value=="Bank")
          newwin = window.open("../transaction/ais_transaction_coapicker.php?idx="+idx+"&FormName=[var.HTMLFormName]"+"&Field=skada"+idx+"&BMode=MEM","skadasearch","height=400,width=640,noscroll,noresizable");
       else if (document.[var.HTMLFormName].type.value=="Cash")
          newwin = window.open("../transaction/ais_transaction_coapicker.php?idx="+idx+"&FormName=[var.HTMLFormName]"+"&Field=skada"+idx+"&BMode=MEM","skadasearch","height=400,width=640,noscroll,noresizable");
 }

 // add by Chandra (19 feb)
 function setCurrency(curr){
    document.[var.HTMLFormName].[headbln.curr].value = curr;
    GetRate(curr)
 }
 </script>
</html>
